package cn.wxz1997.permission.util;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

/**
 * @Description: ${todo}
 * @Author: wxz1997
 * @Date 18-8-5下午8:25
 */
@Builder
@Setter
@Getter
public class Result<T> {

    private Integer code;
    private String msg;
    private T data;

    public static Result success(){
        return Result.builder().code(1).build();
    }

    public static <T> Result<T> success(T data){
        return  Result.<T>builder().code(1).data(data).build();
    }

    public static Result error(){
        return Result.builder().code(0).build();
    }

    public static Result error(String msg){
        return  Result.builder().code(0).msg(msg).build();
    }

    public static Result error(Integer code, String msg){
        return  Result.builder().code(code).msg(msg).build();
    }
}
